package org.example.service.impl;

import org.example.controller.pojo.MenuItem;
import org.example.service.MenuService;
import org.springframework.stereotype.Service;

import java.util.LinkedList;
import java.util.List;

@Service
public class MenuServiceImpl implements MenuService {

    @Override
    public List<MenuItem> buildMenu() {
        LinkedList<MenuItem> menuItems = new LinkedList<>();
        MenuItem r1 = new MenuItem(1, "root 1");
        menuItems.add(r1);
        MenuItem l21 = new MenuItem(5, "layer 2_1");
        r1.addSubitem(l21);
        MenuItem l22 = new MenuItem(6, "layer 2_2");
        r1.addSubitem(l22);


        MenuItem r2 = new MenuItem(2, "root 2");
        menuItems.add(r2);

        return menuItems;
    }

    @Override
    public List<MenuItem> buildMenuFromList(MenuItem[] items) {
        return  null;
    }
}
